<?php

use Phinx\Migration\AbstractMigration;

class AddColumnShipNumberInvoiceTypeInvoiceNumberInInvoiceTable extends AbstractMigration
{
    public function up()
    {
        $this->table("invoice")->addColumn("invoice_number", "string", [
            'limit' => "255",
            'default' => '',
            'null' => false,
            'comment' => '发票代码',
        ])
            ->addColumn("ship_number", "string", [
                'limit' => "255",
                'default' => '',
                'null' => false,
                'comment' => '快递编号',
            ])
            ->addColumn("invoice_type", "enum", [
                'values' => "paper,electronic",
                'default' => 'paper',
                'null' => false,
                'comment' => '发票类型',
            ])
            ->save();
    }

    public function down()
    {
        $this->table("invoice")
            ->removeColumn("ship_number")
            ->removeColumn("invoice_number")
            ->removeColumn("invoice_type")
            ->save();
    }
}
